import { defineConfig } from 'umi';
import { resolve } from 'path';

const { REACT_APP_ENV, NODE_ENV } = process.env;

export default defineConfig({
  antd: {
    // dark: true, // 开启暗色主题
    // compact: true, // 开启紧凑主题
  },
  nodeModulesTransform: {
    type: 'none',
  },

  headScripts: [
    'https://www.iqihang.com/zt/common/js/jquery-2.0.0.min.js',
    'https://www.iqihang.com/zt/common/js/wow.min.js',
    'https://www.iqihang.com/zt/bnjx/js/swiper.js',
    'https://visitor.yunduocrm.com/static/delopJsBuild/1.0/delopAllJs.js',
  ],

  styles: [
    `https://www.iqihang.com/zt/common/css/common.css`,
    `https://www.iqihang.com/zt/22quan/css/animate.min.css`,
    `https://www.iqihang.com/zt/22quan/css/swiper.min.css`,
  ],

  routes: [
    { path: '/', component: '@/pages/Editor' },
    { path: '/index', component: '@/pages/Index' },
    { path: '/editor', component: '@/pages/Editor' },
    { path: '/result', component: '@/pages/Editor/components/Result' },
    {
      name: '供应链管理',
      icon: 'smile',
      path: '/scm',
      microApp: 'scm',
    },
    {
      name: '供应链管理',
      icon: 'smile',
      path: '/purehtml',
      microApp: 'purehtml',
    },
    {
      name: '供应链管理',
      icon: 'smile',
      path: '/mzt',
      microApp: 'mzt',
    },
  ],

  alias: {
    components: resolve(__dirname, '../src/components/'),
    node_modules: resolve(__dirname, '../src/node_modules/'),
    utils: resolve(__dirname, '../src/utils'),
    assets: resolve(__dirname, '../src/assets'),
  },

  // proxy: proxy[REACT_APP_ENV || 'dev'],
  proxy: {
    '/manage': {
      target: 'https://api-test.iqihang.com/',
      changeOrigin: true,
    },
    '/api': {
      target: 'https://www.iqihang.com/',
      changeOrigin: true,
    },
  },
});
